export default (props: any, type = 'bar') => {
    const options = {
        // title: {
        //     text: 'Stacked Line'
        // },
        tooltip: {
            trigger: 'axis'
        },
        legend: {
            data: ['Email', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
        },
        grid: {
            left: '3%',
            right: '4%',
            bottom: '3%',
            containLabel: true
        },
        // toolbox: {
        //     feature: {
        //         saveAsImage: {} // 保存为图片
        //     }
        // },
        xAxis: {},
        yAxis: {},
        series: props.options.series
    };
    if (['x', undefined].includes(props.options.direction)) {
        options.yAxis = {
            type: 'value'
        }
        options.xAxis = {
            type: 'category',
            // boundaryGap: false, // 铺满
            data: props.options.axis
        }
    } else {
        options.xAxis = {
            type: 'value'
        }
        options.yAxis = {
            type: 'category',
            // boundaryGap: false, // 铺满
            data: props.options.axis
        }
    }
    return {
        options
    }
}